package com.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "StudentServlet", value = "/StudentServlet")
public class StudentServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String name = request.getParameter("name");
        String mobile = request.getParameter("mobile");
        String sex = request.getParameter("sex");
        //为数组了
        String[] specs = request.getParameterValues("spec");
        PrintWriter out = response.getWriter();
        out.println("name:");
        out.println(name);
        out.println("mobile:");
        out.println(mobile);
        out.println("sex:");
        out.println(sex);
        for (String spec : specs) {
            out.println("spec:"+spec);
        }
    }
}
